package com.ophiux.utils.wechat;

import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;

public class WXCommUtils {

	
	public static  String inputStream2String(InputStream in){
        if(in == null)
            return "";
        
        StringBuffer out = new StringBuffer();
        byte[] b = new byte[4096];
        try {
			for (int n; (n = in.read(b)) != -1;) {
			    out.append(new String(b, 0, n, "UTF-8"));
			}
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
        finally{
        	try {
				in.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
        }
        return out.toString();
    }
	
}
